import request from '@/utils/request'
import axios from 'axios'

export function login(data) {
  const eee = 'username=' + data.username + '&password=' + data.password + '&client_id=Blog_App&client_secret=1q2w3e*&grant_type=password'
  const config = {
    method: 'post',
    url: process.env.VUE_APP_BASE_API + '/connect/token',
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
    },
    data: eee
  }

 return axios(config)
}

export function getInfo(token) {
    return request({
        url: '/api/blog/user/info',
        method: 'get'

    })
}

export function logout() {
    return request({
        url: '/user/logout',
        method: 'post'
    })
}
